package com.k2sigma.ems.test;

import com.k2data.k2app.enablement.response.CommonResultResponse;
import com.k2sigma.ems.client.EmsClient;
import com.k2sigma.ems.client.vo.SendMailVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.Map;

/**
 * Created by Kong on 2017/6/12.
 */

@RestController
public class EmsController {

    @Autowired
    EmsClient emsClient;

    @RequestMapping(value = "/ems", method = RequestMethod.GET)
    public CommonResultResponse sendMailByDefault() {
        SendMailVo sendMailVo = new SendMailVo();
        sendMailVo.setTo("konglingjun@k2data.com.cn");
        sendMailVo.setTemplateName("validate");

        Map<String, Object> params = new HashMap();
        params.put("account", "18888888888");
        params.put("mail", "konglingjun@k2data.com.cn");
        params.put("url", "http://www.zhibo8.com");
        params.put("date", "2017-6-12");

        sendMailVo.setParams(params);

        CommonResultResponse response =  emsClient.sendMail(sendMailVo);
        return response;
    }

}
